using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO;

namespace ByteArrayToASCII
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Regex rx = new Regex(@"((?<=0[Xx])[\dabcdef]{1,2})|([\dabcdef]{1,2})(?![xX])", RegexOptions.IgnoreCase);
            StringBuilder oStringBuilder = new StringBuilder();
            Match oMatch = rx.Match(textByteArray.Text);
            while (oMatch.Success)
            {
                oStringBuilder.Append(string.Format("{0}", Convert.ToChar(Convert.ToByte(oMatch.Value, 16))));
                oMatch = oMatch.NextMatch();
            }

            textAcsii.Text = oStringBuilder.ToString();
        }
    }
}